package com.victor.dao;

import java.util.List;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.alibaba.druid.sql.visitor.functions.Insert;
import com.victor.entity.Express;
import com.victor.entity.JingqubusinessOrder;
import com.victor.entity.JingqubusinessOrderShop;
import com.victor.entity.JqOrderShopParameter;
import com.victor.entity.Parameter;
import com.victor.entity.Specifications;


@Mapper
public interface OrderDao {

	/**
	 * app添加订单
	 * @param order
	 * @return
	 */
	boolean addOrder(JingqubusinessOrder order);
	
	/**
	 * app添加购买的商品列表
	 * @param jingqubusinessOrderShop
	 * @return
	 */
	boolean addOrderShop(JingqubusinessOrderShop jingqubusinessOrderShop);
	
	/**
	 * 根据字段，查询order列表
	 */
	List<JingqubusinessOrder> selectOderList(JingqubusinessOrder order);

	/**
	 * 	根据搜索框查询订单列表
	 * @return
	 */
	List<JingqubusinessOrder> selectOderListBySearch(String search);

	/**
	 * 	批量删除
	 */
	int batchDelete(@Param("ids") int[] ids);
	//批量删除订单收件人信息
	boolean batchDeleteAddress(@Param("ids") int[] ids);
	//批量删除订单快递信息
	boolean batchDeleteExpress(@Param("ids") int[] ids);
	//批量删除购买商品列表
	boolean batchDeleteShops(@Param("ids") int[] ids);
	
	/**
	 * 	订单详情
	 * @param id
	 * @return
	 */
	JingqubusinessOrder selectDeatil(@Param("id") Integer id);
	
	/**
	 * 	接单
	 * 	向快递信息中添加物流
	 * @param order
	 * @return
	 */
	@Update({"Update jingqubusiness_order set state=#{state} where id=#{i} "})
	boolean receivingOrder(Integer i,String state);
	//向快递信息中添加物流
	boolean addExpress(Express express);
	/**
	 * 根据uid查询订单
	 * @param uid
	 * @return
	 */
	List<JingqubusinessOrder> selByUid(String uid);
	/**
	 * 根据uid查询订单
	 * @param uid
	 * @return
	 */
	List<JingqubusinessOrder> selAllByUid(@Param("uid")String uid,@Param("state")String state);
	
	/**
	 * 根据oid查询
	 * @param id
	 * @return
	 */
	List<JingqubusinessOrderShop> selByOid(String id);
	/**
	 * 根据id查询订单
	 * @param oid
	 * @return
	 */
	JingqubusinessOrder selById(String oid);
	/**
	 * 修改订单状态
	 * @param state
	 * @return
	 */
	boolean updateOrder(JingqubusinessOrder order);
	
}
